Chapter 8

Visualizing phase portraits and eigenvalues.

Visualizing a chemical oscillator.

Here we consider the chemical oscillator introduced in this chapter modeled by the following system of equations:

\begin{align} x_1' &= k_1-x_1\Big( 1+\dfrac{4x_2}{1+x_1^2}\Big), \\ x_2' &= k_2x_2\Big( 1-\dfrac{x_2}{1+x_1^2}\Big), \end{align}

for constants $k_1, k_2 > 0$. Here $x_1(t)$ and $x_2(t)$ correspond to the concentration levels of certain molecules and the constants $k_1$ and $k_2$ depend on reaction rates and other information. Since the $x_j$’s are modeling concentrations of two molecules, we are mainly interested in $x_1, x_2 > 0$.

For this pair of ODE’s, for certain values of $(k_1, k_2)$ (for example $k_1 = 10$ and $k_2 = 2$, which are the default parameters in the graph below), the solutions all seem to spiral around and around, converging towards a specific orbiting path. This “attracting oscillator” trajectory corresponds to the chemical system oscillating between several states.

In order to understand if the ODE model predicts (for certain $(k_1, k_2)$) the observed periodic behavior, we plot the phase portrait of the system. To play with the visulization yourself, change the parameters, and see how the graph changes. Choose your desired initial condition by dragging the blue point on the graph. The red point is the unique stationary point. The range of $(k_1, k_2)$ where the system has an “attracting oscillator” trajectory is shown on the left.

Parameters

Display Options




Outputs

The shaded region is the range of $(k_1, k_2)$ where the system has an “attracting oscillator” trajectory.

Phase Portrait

Visualizing first-order linear systems with distinct real nonzero eigenvalues.

Here we visualize the solutions to the first-order linear system of the form

\begin{align} \mathbf{x}'(t) = A\mathbf{x}(t) \end{align}

for a $2\times 2$ matrix $A$, where $A$ has distinct real nonzero eigenvalues $\lambda_1$ and $\lambda_2$, with corresponding eigenvectors $\mathbf{v}_1$ and $\mathbf{v}_2$.

We can calculate $A$ using its eigenvalues and eigenvectors. Putting the system of equations \begin{align} \begin{cases} A\mathbf{v}_1 = \lambda_1 \mathbf{v}_1 \\ A\mathbf{v}_2 = \lambda_2 \mathbf{v}_2 \end{cases} \end{align} into matrix form yields \begin{align} A \begin{bmatrix} \mathbf{v}_1 & \mathbf{v}_2 \end{bmatrix} &= \begin{bmatrix}\lambda_1 \mathbf{v}_1 & \lambda_2\mathbf{v}_2 \end{bmatrix} \\ &= \begin{bmatrix}\mathbf{v}_1 & \mathbf{v}_2 \end{bmatrix}\begin{bmatrix} \lambda_1 & 0 \\ 0 & \lambda_2 \end{bmatrix}.\\ \end{align} Let $V = \begin{bmatrix} \mathbf{v}_1 & \mathbf{v}_2 \end{bmatrix}$, and $D = \begin{bmatrix} \lambda_1 & 0 \\ 0 & \lambda_2 \end{bmatrix}$. Then $AV = VD$, so $A = VDV^{-1}$.

The solutions of the linear sysmtem $\mathbf{x}'(t) = A\mathbf{x}(t)$ are all of the form $$\mathbf{x}(t) = k_1e^{\lambda_1t}\mathbf{v}_1 + k_2e^{\lambda_2t}\mathbf{v}_2,$$ for some uniquely determined $k_1, k_2 \in \mathbf{R}$.

To play with the visulization yourself, pick values for $\lambda_1,\lambda_2$, and drag $\mathbf{v}_2$ to your desired position:

Eigenvalues

Eigenvectors

$\mathbf{v}_1 = [1,0]^{\top}$, corresponding to $\lambda_1$

$\mathbf{v}_2 = [$0, 1$]^{\top}$, corresponding to $\lambda_2$

ATTENTION: $\mathbf{v}_1$ and $\mathbf{v}_2$ must be linearly independent!


Phase Portrait

ATTENTION: $\lambda_1$ and $\lambda_2$ must be distinct!

ATTENTION: Eigenvalues need to be nonzero!


Visualizing first-order linear systems using eigenvector bases.

Here we visualize the solutions to the first-order linear system of the form

\begin{align} \mathbf{x}'(t) = A\mathbf{x}(t) \end{align}

for a $2\times 2$ matrix $A = \begin{bmatrix}a & b \\ c & d \end{bmatrix}$ that has two distinct nonzero eigenvalues.

To play with the visulization yourself, pick values for constants $a,b,c,d$, and choose your prefered display options:

Constants

Outputs

The determinant of $A$ is $\operatorname{det}(A) = ad-bc = $ .

ATTENTION: The determinant is zero. Please change $A$ to make it nonzero.

The associated characteristic polynomial is $\lambda^2 - \operatorname{tr}(A) \lambda + \operatorname{det}(A) = \lambda^2$+$\lambda$-1.5.

ATTENTION: Please change $A$ to make them distinct.

The eigenvalues of $A$ are $\lambda_1 =$ , $\lambda_2 =$ .

Corresponding eigenvectors are $\mathbf{v}_1 = [$$]^{\top}$ and $\mathbf{v}_2 = [$$]^{\top}$.

The phase portrait is shown on the right.

Phase Portrait

ATTENTION: To see the visualization, please change $A$ to make the eigenvalues distinct!

ATTENTION: To see the visualization, please change $A$ to make the determinant nonzero!


Generating phase portraits for your own ODE system.

You can go to the site below to generate your own phase portraits. Have fun!